package com.gict.antifraudback.entity;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.NotBlank;

@Data
@TableName("users")
public class User extends BaseEntity {

    /**
     * 姓名
     */
    @NotBlank(message = "用户名不能为空")
    private String name;

    /**
     * 角色 ['admin']，数据库存json
     */
    @NotBlank(message = "角色不能为空")
    private String roles;

    /**
     * 数据库存json数组
     * 权限 ['READ', 'WRITE', 'DELETE']
     */
    private String ability;

    /**
     * 账号
     */
//    @NotBlank(message = "账号不能为空")
    private String username;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    private String password;

    /**
     * 个性签名
     */
    private String introduction;

    /**
     * 头像
     */
    private String avatar;

    @TableField(exist = false)
    private JSONArray rolesArray;
    @TableField(exist = false)
    private JSONArray abilityArray;

}